#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>


int main(int argc,const char* argv[]){
    if(argc != 2){
        return -1;
    }
    FILE*fp = fopen(argv[1],"w+");
    if(fp == NULL){
        printf("fopen err\n");
        return -1;
    }

    float arr[3]={1.23,1.25,2.56};
    float data[3]={0.0};

    fwrite(arr,sizeof(arr),1,fp);
    rewind(fp);
    fread(data,sizeof(data),1,fp);

    printf("%.2f %.2f %.2f\n",data[0],data[1],data[2]);




    FILE*fp_text = fopen("./b.bin","w+");
    if(fp == NULL){
        printf("fopen err\n");
        return -1;
    }

    char ch[]="123456";
    char chs[7]={0};


    fwrite(ch,sizeof(ch),1,fp_text);
    rewind(fp_text);
    fread(chs,sizeof(ch),1,fp_text);

    printf("%s\n",chs);




    fclose(fp);
    fp=NULL;
    return 0;
}